home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Font;
- import java.awt.FontMetrics;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.MediaTracker;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseListener;
- import java.net.InetAddress;
- import java.net.URL;
-
- public class IPViewer extends Applet implements MouseListener {
- // $FF: renamed from: wi int
- int field_0;
- // $FF: renamed from: he int
- int field_1;
- private int wiBack;
- private int heBack;
- // $FF: renamed from: ip java.lang.String
- String field_2;
- String text;
- Image backImage;
- boolean loaded;
- private String statusBarText;
- private boolean isBackImage = false;
- private String backImageName;
- private Color backColor;
-
- public String getAppletInfo() {
- return "Name: IPViewer\r\nAuthor: Taiji Software\r\n";
- }
-
- public IPViewer() {
- ((Component)this).addMouseListener(this);
- }
-
- public void register() {
- try {
- URL u = new URL("http://www.taijisoftware.com");
- ((Applet)this).getAppletContext().showDocument(u, "_blank");
- ((Applet)this).stop();
- } catch (Exception e) {
- System.out.println(e);
- ((Applet)this).stop();
- }
- }
-
- public void init() {
- String codeBase = null;
-
- try {
- codeBase = (new URL(((Applet)this).getCodeBase().toString())).getHost();
- System.out.println("Copyright 1999, 2001 Taiji Software(tm)\nYour domain name is : " + codeBase);
- codeBase = codeBase.toUpperCase();
- } catch (Exception var11) {
- }
-
- if (!((Applet)this).getCodeBase().toString().toUpperCase().startsWith("FILE") || ((Applet)this).getParameter("debug") != null) {
- String regCode = ((Applet)this).getParameter("registration_code");
- if (regCode == null) {
- regCode = ((Applet)this).getParameter("reg_domain");
- if (regCode == null) {
- this.register();
- } else {
- if (regCode.length() == codeBase.length() + 4 && !codeBase.startsWith("WWW.")) {
- codeBase = "WWW." + codeBase;
- } else if (regCode.length() == codeBase.length() - 4 && codeBase.startsWith("WWW.")) {
- codeBase = codeBase.substring(4);
- }
-
- char[] chars = new char[codeBase.length()];
- codeBase.getChars(0, codeBase.length(), chars, 0);
- String key = new String("haricot");
- char[] chars2 = new char[key.length()];
- key.getChars(0, key.length(), chars2, 0);
-
- for(int i = 0; i < codeBase.length(); ++i) {
- int j;
- if (i >= key.length()) {
- j = i - key.length() * (i / key.length());
- } else {
- j = i;
- }
-
- chars[i] += chars2[j];
- chars[i] = (char)(chars[i] - chars[i] / 26 * 26 + 97);
- }
-
- String res = new String(chars);
- if (!res.equalsIgnoreCase(regCode)) {
- this.register();
- }
- }
- } else if (!regCode.equals("settevercsedegnamiaj") && !regCode.equals("8078")) {
- this.register();
- }
- }
-
- this.getParameters();
-
- try {
- this.field_2 = InetAddress.getLocalHost().getHostAddress();
- } catch (Exception var10) {
- this.field_2 = "could not read ip";
- }
-
- if (this.isBackImage) {
- this.backImage = ((Applet)this).getImage(((Applet)this).getCodeBase(), this.backImageName);
- MediaTracker tracker = new MediaTracker(this);
- tracker.addImage(this.backImage, 0);
-
- try {
- tracker.waitForAll();
- this.loaded = !tracker.isErrorAny();
- } catch (Exception e) {
- System.err.println(e);
- }
-
- if (!this.loaded) {
- ((Applet)this).stop();
- }
- } else {
- this.loaded = true;
- }
-
- if (this.isBackImage) {
- this.wiBack = this.backImage.getWidth(this);
- this.heBack = this.backImage.getHeight(this);
- }
-
- ((Component)this).repaint();
- }
-
- public void getParameters() {
- this.field_0 = ((Component)this).getSize().width;
- this.field_1 = ((Component)this).getSize().height;
- this.text = ((Applet)this).getParameter("text");
- this.statusBarText = ((Applet)this).getParameter("status_bar_text");
- if (this.text == null) {
- this.text = "Your IP is:";
- }
-
- this.backImageName = ((Applet)this).getParameter("background_image");
- if (this.backImageName != null) {
- this.isBackImage = true;
- }
-
- this.backColor = this.getColor("background_color");
- ((Component)this).setBackground(this.backColor);
- }
-
- public Color getColor(String param) {
- String s = ((Applet)this).getParameter(param);
- if (s != null) {
- if (s.substring(0, 1).equals("#")) {
- s = s.substring(1);
- int i = Integer.parseInt(s, 16);
- return new Color(i);
- } else {
- return null;
- }
- } else {
- return null;
- }
- }
-
- public void paint(Graphics g) {
- if (this.loaded) {
- if (this.isBackImage & this.loaded) {
- g.drawImage(this.backImage, (this.field_0 - this.wiBack) / 2, (this.field_1 - this.heBack) / 2, this);
- }
-
- int h = (int)((float)this.field_1 / 40.0F * 12.0F);
- g.setFont(new Font("TimesRoman", 1, h));
- FontMetrics fm = g.getFontMetrics();
- int w = fm.stringWidth(this.field_2);
- int v = fm.stringWidth(this.text);
- g.drawString(this.text, (this.field_0 - v) / 2, (int)((float)this.field_1 / 40.0F * 15.0F));
- g.drawString(this.field_2, (this.field_0 - w) / 2, (int)((float)this.field_1 / 40.0F * 32.0F));
- }
- }
-
- public void update(Graphics g) {
- this.paint(g);
- }
-
- public void mouseClicked(MouseEvent e) {
- }
-
- public void mouseEntered(MouseEvent e) {
- if (this.statusBarText != null) {
- ((Applet)this).showStatus(this.statusBarText);
- }
-
- }
-
- public void mouseExited(MouseEvent e) {
- }
-
- public void mousePressed(MouseEvent e) {
- }
-
- public void mouseReleased(MouseEvent e) {
- }
- }
-